Image processing system, setting method, and program

ABSTRACT

An image processing system includes one or more processors that select one target algorithm from evaluation algorithms, calculate an evaluation value indicating adaptation to image measurement using the target algorithm and one or more evaluation images corresponding to an evaluation lighting pattern for each evaluation lighting pattern, and determine a lighting pattern to be used for the image measurement from evaluation lighting patterns based on the evaluation value.

TECHNICAL FIELD

The present disclosure relates to an image processing system, a settingmethod, and a program.

BACKGROUND ART

An image processing technology in which a target is imaged underlighting by light from a lighting device to acquire information aboutthe target from generated image data is used in a factory automation(FA) field and the like.

In the case of use of the lighting device having many settableconditions such as a color and a direction of lighting, an optimumlighting pattern is appropriately selected from a large number oflighting patterns. For example, Japanese Patent Laying-Open No.2003-270163 (PTL 1) discloses a technique of calculating a lightingcondition for optimizing an evaluation value based on a plurality ofcaptured images obtained by imaging a condition setting article whilechanging the lighting condition and inspecting an inspection targetarticle under the calculated light condition.

CITATION LIST Patent Literature

PTL 1: Japanese Patent Laying-Open No. 2003-270163

PTL 2: Japanese Patent Laying-Open No. 7-220058

SUMMARY OF INVENTION Technical Problem

In the technique disclosed in PTL 1, the lighting condition is optimizedbased on a uniform evaluation value. However, in image measurement usingan external appearance image of the target, a method for evaluatingadaptation to the image measurement may be different depending on astate of the target or a content of the image processing performed onthe external appearance image. Consequently, the lighting conditionoptimized based on the uniform evaluation value may not be suitable forthe image measurement.

The present disclosure has been made in view of the above problems, andan object of the present disclosure is to provide an image processingsystem, a setting method, and a program capable of more easilyperforming lighting setting of the illumination so as to be suitable forthe image measurement using the external appearance image of the target.

Solution to Problem

According to an example of the present disclosure, an image processingsystem that performs image measurement using an external appearanceimage of a target includes: an imaging unit that images a target and alighting unit that includes a plurality of lighting elements thatirradiates the target with light and is capable of adjusting at leastone of emission intensity and emission color for each lighting element.The image processing system further includes an image acquisition unit,a selection unit, a calculation unit, and a pattern determination unit.The image acquisition unit emits illumination light from the lightingunit according to each of a plurality of evaluation lighting patternsdifferent from each other, and acquires at least one evaluation imagecorresponding to each evaluation lighting pattern from the imaging unit.The selection unit selects one target algorithm from a plurality ofevaluation algorithms. For each evaluation lighting pattern, thecalculation unit calculates the evaluation value indicating theadaptation to the image measurement using the target algorithm and atleast one evaluation image corresponding to the evaluation lightingpattern. The pattern determination unit determines the lighting patternto be used for the image measurement from among the plurality ofevaluation lighting patterns based on the evaluation value.

According to this disclosure, the evaluation algorithm suitable for theimage measurement is selected from the plurality of evaluationalgorithms, so that the lighting pattern optimal for the imagemeasurement is automatically determined as the measurement lightingpattern. Thus, the lighting setting of the illumination can be easilyperformed so as to be suitable for the image measurement using theexternal appearance image of the target.

In the above disclosure, the plurality of evaluation algorithms includea first algorithm and at least one second algorithm. The first algorithmoutputs a first evaluation value depending on a difference between atleast one first region and at least one second region in at least oneevaluation image as the evaluation value. The at least one secondalgorithm outputs a second evaluation value depending on uniformity ofthe at least one second region as the evaluation value.

For example, in the image measurement detecting the defect on thesurface of target, the image processing is performed in order toemphasize the defect portion. When the image processing capable ofemphasizing the background together with the defect portion isperformed, the lighting pattern in which the background is as uniform aspossible is preferable. According to the above disclosure, the regionincluding the defect is set as the first region, the region of thebackground not including the defect is set as the second region, and thesecond algorithm is selected as the target algorithm, so that thelighting pattern in which the background is uniform can be determined asthe measurement lighting pattern. On the other hand, when the imageprocessing in which the background is not so emphasized is performed,the lighting pattern in which the difference between the defect portionand the background increases is preferable. In such a case, the firstalgorithm is selected as the target algorithm, so that the lightingpattern in which the difference between the defect portion and thebackground increases can be determined as the measurement lightingpattern.

In the above disclosure, at least one second algorithm includes aplurality of second algorithms having different contribution rates ofthe uniformity to the second evaluation value.

According to the above disclosure, the second algorithm having thecontribution rate suitable for the image measurement can be selectedfrom the plurality of second algorithms. Thus, the lighting patternsuitable for the image measurement is determined as the measurementlighting pattern.

In the above disclosure, for example, each of at least one secondalgorithm outputs the second evaluation value using the threshold valuewhen the value corresponding to the variance of the luminance of theplurality of pixels belonging to at least one second region is smallerthan the threshold value, and each of at least one second algorithmoutputs the second evaluation value using the value corresponding to thevariance when the value corresponding to the variance is greater than orequal to the threshold value. The threshold value is set according to atleast one second algorithm.

In the above disclosure, the image processing system further includes auser interface. The calculation unit determines a shape, a size, and aposition of at least one first region according to input to the userinterface. The calculation unit sets the shape and size of at least onesecond region to be identical to the shape and size of at least onefirst region. The calculation unit determines the position of at leastone second region according to the input to the user interface.

According to the present disclosure, the user does not need to set theshape and size of the second region by setting the shape, size, andposition of the first region. As a result, labor required for settingthe second region is reduced.

In the above disclosure, the plurality of evaluation algorithms outputsa third evaluation value indicating an edge-likelihood of a pixelbelonging to a designated region in at least one evaluation image usingedge patterns different from each other as the evaluation value.

According to this disclosure, for example, when the surface of thetarget has a line or a pattern extending in a certain direction, anevaluation lighting pattern that emphasizes the line or the pattern isdetermined as a lighting pattern to be used for image measurement byselecting an evaluation algorithm corresponding to the direction.

In the above disclosure, at least one evaluation image includes aplurality of evaluation images. The calculation unit calculates theevaluation value for each of the plurality of evaluation images. Thepattern determination unit extracts the lowest evaluation value havingthe lowest adaptation from the evaluation values for the plurality ofevaluation images for each evaluation lighting pattern. The patterndetermination unit determines the evaluation lighting pattern in whichthe lowest evaluation value having the highest adaptation is extractedfrom the plurality of evaluation lighting patterns as the lightingpattern to be used for the image measurement.

According to the present disclosure, the lighting pattern stably havinghigh adaptation is determined as the lighting pattern to be used for theimage measurement.

In the above disclosure, the plurality of lighting patterns that can betaken by the lighting unit are previously divided into a plurality ofgroups. The image acquisition unit selects at least one group from theplurality of groups, and determines the plurality of lighting patternsbelonging to the selected at least one group as a plurality ofevaluation lighting patterns.

According to this disclosure, even when the total number of lightingpatterns that can be taken by the lighting unit is enormous, the groupsuitable for the image measurement is selected, so that the timerequired for determining the lighting pattern to be used for the imagemeasurement can be shortened.

In the above disclosure, the plurality of lighting elements are radiallyarranged along the first to Nth radial directions at equal angularintervals. N is an integer greater than or equal to 2. The plurality ofgroups include a first group including the plurality of lightingpatterns in which the irradiation intensity of the first to Nth radialdirections is uniform and a second group including the plurality oflighting patterns in which only the lighting element disposed in one ofthe first to Nth radial directions is turned on.

In the above disclosure, N is an even number greater than or equal to 4.The plurality of groups may further include a third group including theplurality of lighting patterns in which only lighting elements arrangedalong a pair of radial directions opposite to each other in the first toNth radial directions are turned on.

In the above disclosure, the plurality of groups may include a firstgroup including the plurality of lighting patterns in which the emissioncolor of the plurality of lighting elements is white and a second groupincluding the plurality of lighting patterns in which the emission colorof the plurality of lighting elements is a color other than white.

In the above disclosure, the image processing system further includes auser interface. The selection unit selects the target algorithmaccording to the input to the user interface.

According to this disclosure, the user can select the evaluationalgorithm suitable for the image measurement as the target algorithm.

According to an example of the present disclosure, a setting method forperforming lighting setting of a lighting unit that includes a pluralityof lighting elements irradiating a target with light and is capable ofadjusting at least one of emission intensity and emission color for eachlighting element includes the following first to fourth steps. The firststep is a step of emitting illumination light from the lighting unitaccording to each of a plurality of evaluation lighting patternsdifferent from each other, and acquiring at least one evaluation imagecorresponding to each evaluation lighting pattern from the imaging unitthat images the target. The second step is a step of selecting onetarget algorithm from the plurality of evaluation algorithms. For eachevaluation lighting pattern, the third step is a step of calculating theevaluation value indicating the adaptation to the image measurement inwhich the external appearance image of the target is used using thetarget algorithm and at least one evaluation image corresponding to theevaluation lighting pattern. The fourth step is a step of determiningthe lighting pattern to be used for the image measurement from theplurality of evaluation lighting patterns based on the evaluation value.

According to still another example of the present disclosure, a programcauses a computer to execute the above setting method. According tothese disclosures, the lighting setting of the illumination can be moreeasily performed so as to be suitable for the image measurement usingthe external appearance image of the target.

Advantageous Effects of Invention

According to the present disclosure, the lighting setting of theillumination can be more easily performed so as to be suitable for theimage measurement using the external appearance image of the target.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a view illustrating a configuration example of an imageprocessing system.

FIG. 2 is a schematic view illustrating a basic configuration of animage processing system 1.

FIG. 3 is a view illustrating an XZ-section of a lighting device.

FIG. 4 is a bottom view of the lighting device.

FIG. 5 is a schematic view illustrating a hardware configuration of acontrol device.

FIG. 6 is a flowchart illustrating a flow of determination of ameasurement lighting pattern.

FIG. 7 is a view illustrating an example of a defect region and abackground region set in an evaluation image.

FIG. 8 is a view illustrating the lighting pattern belonging to a firstgroup.

FIG. 9 is a view illustrating the lighting pattern belonging to a secondgroup.

FIG. 10 is a view illustrating the lighting pattern belonging to a thirdgroup.

FIG. 11 is a view illustrating an example of a setting screen optimizingthe lighting pattern.

FIG. 12 is a view illustrating an example of the setting screen when atab 61 setting the defect region is operated.

FIG. 13 is a view illustrating an example of the setting screen when anedit button in FIG. 12 is operated.

FIG. 14 is a view illustrating an example of the setting screen after aposition and a size of a frame line indicating a range of the defectregion are changed.

FIG. 15 is a view illustrating an example of the setting screen when thebackground region is set.

FIG. 16 is a view illustrating another example of the setting screenwhen an additional background region and an additional defect region areset.

FIG. 17 is a view illustrating an example of evaluation value data.

FIG. 18 is a view illustrating a list of evaluation values displayed onthe setting screen.

FIG. 19 is an enlarged view illustrating a part of four evaluationimages obtained under lighting of four evaluation lighting patternshaving different brightness.

FIG. 20 is a view illustrating a value of a′ calculated from theevaluation image in FIG. 19.

FIG. 21 is a view illustrating an evaluation value E calculated from theevaluation image in FIG. 19.

FIG. 22 is a view illustrating a result of image processing performed onthe evaluation image in FIG. 19.

FIG. 23 is a view illustrating an example of eight edge patterns.

FIG. 24 is a view illustrating another configuration example of theimage processing system.

DESCRIPTION OF EMBODIMENTS

With reference to the drawings, an embodiment of the present inventionwill be described in detail. The same or equivalent portion in thedrawings is denoted by the same reference numeral, and the descriptionwill not be repeated.

§ 1 Application Example

With reference to FIG. 1, an application example of the presentinvention will be described. FIG. 1 is a view illustrating aconfiguration example of an image processing system.

An image processing system 1 illustrated in FIG. 1 is a system thatperforms image measurement using an external appearance image of atarget. Image processing system 1 includes a camera 8 that is an exampleof an imaging unit that images the target, a lighting device 4 that isan example of an irradiation unit that irradiates the target with light,and a control device 100 that controls processing executed in imageprocessing system 1.

Lighting device 4 includes a plurality of lighting elements 40 thatirradiate the target with light. In the example of FIG. 1, lightingdevice 4 includes 13 lighting elements 40. In FIG. 1, a referencenumeral of the lighting element 40 is partially omitted. The number oflighting elements 40 is not limited to the example in FIG. 1, but may beat least two. The sizes of lighting elements 40 may be different fromeach other, or may be common to each other. Lighting elements 40 may bearranged on the same plane, arranged on planes different from eachother, or arranged to be able to irradiate the target with light fromlighting elements 40. Lighting device 4 can adjust emission intensityand an emission color for each lighting element 40. At this point, thefact that the emission intensity can be adjusted includes not onlyturn-on or -off of each lighting element 40 but also gradual adjustmentof the intensity of light emitted from each lighting element 40.

Control device 100 typically has a structure according to ageneral-purpose computer architecture. Control device 100 includes animage acquisition unit 210, an evaluation algorithm selection unit 220,a calculation unit 230, and a lighting pattern determination unit 240.Typically, image acquisition unit 210, evaluation algorithm selectionunit 220, calculation unit 230, and lighting pattern determination unit240 are implemented by a CPU included in control device 100, the CPUexecuting a program stored in control device 100 or the like.

Image acquisition unit 210 irradiates the target with the illuminationlight from lighting device 4 according to each of a plurality ofevaluation lighting patterns xi different from each other, and acquiresat least one evaluation image R corresponding to each evaluationlighting pattern xi from camera 8. The lighting pattern defines theemission intensity and the emission color of each lighting element 40.

Evaluation algorithm selection unit 220 selects one evaluation algorithmas a target algorithm from the plurality of evaluation algorithms. Theevaluation algorithm defines a calculation method for calculating anevaluation value indicating adaptation of the lighting pattern to theimage measurement using the evaluation image. The evaluation algorithmis represented by a function, a program, or the like calculating theevaluation value.

The plurality of evaluation algorithms are previously set according tovarious methods used in the image measurement using the externalappearance image of the target. For example, when the image measurementinspecting the defect on the surface of the target is performed, thefollowing first algorithm and second algorithm are previously set. Thefirst algorithm is an algorithm calculating a first evaluation valuedepending on a difference between a defect region including a defectportion and a background region not including the defect portion. Thesecond algorithm is an algorithm calculating a second evaluation valuedepending on uniformity of the background region. The first evaluationvalue does not depend on the uniformity of the background region. Thesecond evaluation value may also depend on the difference between thedefect region and the background region.

In the image measurement detecting the defect, the image processingemphasizing the defect portion can be executed on the externalappearance image. Various methods are known as the image processing, andthere are image processing in which the background can be emphasizedtogether with the defect portion and image processing in which thebackground is hardly emphasized. For example, Sobel filter processingcan be cited as the image processing that can emphasize the background.For example, Hough transform processing can be cited as the imageprocessing in which the background is hardly emphasized.

When the image measurement including the image processing in which thebackground is hardly emphasized is performed, the lighting condition inwhich the difference between the defect region and the background regionis large is preferable without considering the uniformity of thebackground region. In this case, the first algorithm is selected. On theother hand, when the image measurement is performed using imageprocessing that can emphasize the background, the lighting conditionthat increases the uniformity of the background region is preferable. Inthis case, the second algorithm is selected.

For each evaluation lighting pattern xi, calculation unit 230 calculatesan evaluation value Pi indicating the adaptation to the imagemeasurement using the target algorithm and evaluation image Rcorresponding to evaluation lighting pattern xi. Specifically,calculation unit 230 calculates a feature amount from evaluation image Rto apply the calculated feature amount to the target algorithm, therebycalculating evaluation value Pi corresponding to evaluation lightingpattern xi. Evaluation value Pi indicates how suitable evaluationlighting pattern xi is for the image measurement.

Lighting pattern determination unit 240 determines the measurementlighting pattern to be used for the image measurement based onevaluation value Pi calculated by calculation unit 230. Typically,lighting pattern determination unit 240 determines evaluation lightingpattern xi corresponding to evaluation value Pi indicating the valuehaving the highest adaptation to the image measurement as themeasurement lighting pattern.

According to image processing system 1 of the embodiment, the lightingpattern optimal for the image measurement is automatically determined asthe measurement lighting pattern by selecting the evaluation algorithmsuitable for the image measurement from among the plurality ofevaluation algorithms. Thus, the lighting setting of the illuminationcan be easily performed so as to be suitable for the image measurementusing the external appearance image of the target.

§ 2 Specific Example A. Configuration of Image Processing System

FIG. 2 is a schematic diagram illustrating a basic configuration ofimage processing system 1. Image processing system 1 includes controldevice 100, camera 8, and lighting device 4 as main components. Controldevice 100 and camera 8 are connected so as to be able to communicatedata with each other. Lighting device 4 is controlled by control device100 through camera 8.

In the following description, for convenience of explanation, adirection in which light is emitted from lighting device 4 is defined asa Z-axis, a horizontal direction of a paper surface is defined as anX-axis, and an axis perpendicular to the X-axis and the Z-axis isdefined as a Y-axis. In addition, a side irradiated with light isdefined as a lower side.

An opening 46 is provided in the upper portion of lighting device 4 suchthat camera 8 can image a target W from above lighting device 4. In theembodiment, camera 8 is installed above lighting device 4. However,camera 8 may be installed such that at least a part of the irradiationregion of lighting device 4 is included in at least a part of an imagingvisual field of camera 8, and may be installed beside lighting device 4.

Camera 8 is an imaging unit that images a subject existing in theimaging visual field to generate the image. Camera 8 includes an opticalsystem such as a lens or a diaphragm and a light receiving element suchas a charge coupled device (CCD) image sensor or a complementary metaloxide semiconductor (CMOS) image sensor as main components.

Control device 100 can receive the setting of the content of the imageprocessing separately from the execution of the image processing such asthe inspection of the existence of the defect or the stain on target W,the measurement of the size, the arrangement, the orientation, or thelike of target W, and the recognition of the character, the figure, orthe like on the surface of target W. The setting of the content of theimage processing includes setting of the imaging condition when theimage is acquired and setting of a processing content executed on theimage. The setting of the imaging condition includes the lightingsetting for lighting device 4 and camera setting for camera 8. Controldevice 100 functions as a device performing the lighting setting forlighting device 4. A setting support device that performs the lightingsetting for lighting device 4 may be provided separately from controldevice 100.

Control device 100 includes a display 101 and a touch panel 102 attachedto a display surface of display 101 as a user interface. Display 101typically includes a liquid crystal display, and for example, displaysthe setting content for the user. Touch panel 102 functions as an inputunit inputting information regarding various settings. For example, theuser operates touch panel 102 based on the information displayed ondisplay 101, thereby being able to input setting information regardingthe setting of the content of the image processing and to performvarious settings. Although the input unit includes a touch panel, theinput unit may include a keyboard, a mouse, or both of them.

B. Configuration of Lighting Device

With reference to FIGS. 3 and 4, a configuration of lighting device 4will be described. FIG. 3 is a view illustrating an XZ-section of thelighting device. FIG. 4 is a bottom view of the lighting device.

A shape of lighting device 4 in FIG. 3 is a dome shape. In lightingdevice 4, a plurality of sets of a plurality of types of light emittingunits (hereinafter, also referred to as a “light source”) havingdifferent main wavelengths are provided at positions facing target W.Specifically, the plurality of sets of light sources including a redlight source r, a green light source g, and a blue light source b areprovided. In FIG. 3, the light source shaded obliquely downward to theleft is red light source r, the light source shaded with a dot patternis green light source g, and the light source shaded obliquely downwardto the right is blue light source b, and reference numerals arepartially omitted.

Lighting device 4 includes a plurality of lighting elements 40. One or aplurality of sets of light sources are provided in each lighting element40. As illustrated in FIG. 4, the plurality of lighting elements 40 arearranged radially along a first radial direction D1 to a fourth radialdirection D4 at 90° intervals. Specifically, the plurality of lightingelements 40 include a central lighting element 41, a lighting element 42(42U, 42M, 42L) provided along first radial direction D1 from lightingelement 41, a lighting element 43 (43U, 43M, 43L) provided along secondradial direction D2 from lighting element 41, a lighting element 44(44U, 44M, 44L) provided along third radial direction D3 from lightingelement 41, and a lighting element 45 (45U, 45M, 45L) provided alongfourth radial direction D4 from lighting element 41.

Incidence azimuths of the light emitted from lighting element 41 to 45are different from each other. The incident azimuth is an azimuthcentered on the Z-axis. The light emitted from the light source oflighting element 41 is reflected by a reflection plate 47 to travelparallel to the Z-axis. The light emitted from the light source oflighting element 42 travels in parallel to the Z axis, and then travelsin the direction inclined to the opposite direction side to first radialdirection D1 (see FIG. 4) by being transmitted through a diffusion plate48 (see FIG. 3) formed in a dome shape. The light emitted from the lightsource of lighting element 43 travels in parallel to the Z axis, andthen travels in the direction inclined to the opposite direction side tosecond radial direction D2 (see FIG. 4) by being transmitted throughdiffusion plate 48. The light emitted from the light source of lightingelement 44 travels in parallel to the Z axis, and then travels in thedirection inclined to the opposite direction side to third radialdirection D3 (see FIG. 4) by being transmitted through diffusion plate48. The light emitted from the light source of lighting element 45travels in parallel to the Z axis, and then travels in the directioninclined to the opposite direction side to fourth radial direction D4(see FIG. 4) by being transmitted through diffusion plate 48.

Lighting element 41 has a circular shape. Lighting elements 42 to 45have an arcuate shape centered on lighting element 41.

Lighting elements 42U, 43U, 44U, 45U are annularly arranged such thatdistances (radius r1) from central lighting element 41 are the same.Lighting elements 42M, 43M, 44M, 45M are annularly arranged such thatdistances (radius r2>r1) from central lighting element 41 are the same.Lighting elements 42L, 43L, 44L, 45L are annularly arranged such thatdistances (radius r3>r2) from central lighting element 41 are the same.An incident angle of the light emitted from lighting elements 42U to 45Uwith respect to the XY-plane, an incident angle of the light emittedfrom lighting elements 42M to 45M with respect to the XY-plane, and anincident angle of the light emitted from lighting elements 42L to 45Lwith respect to the XY-plane are different from each other.

As described above, lighting device 4 includes 13 lighting elements 41,42U to 45U, 42M to 45M, 42L to 45L. However, the number of lightingelements included in lighting device 4 is not limited to 13.

For example, in lighting device 4 of FIG. 4, the plurality of lightingelements 40 are arranged radially along first radial direction D1 tofourth radial direction D4, but the plurality of lighting elements 40may be arranged radially along the first to Nth radial directions atequal angular intervals. N may be an integer greater than or equal to 2.

In lighting device 4 in FIG. 4, the number of lighting elements 40arranged along each radial direction is 3, but the number of lightingelements 40 may be 2 or greater than or equal to 4.

The number of red light sources r, the number of green light sources g,and the number of blue light sources b that are arranged in eachlighting element need not be identical to each other, and at least onelight source for each of these three types of light sources may bearranged in each lighting element. In addition, the ratio of red lightsource r, green light source g, and blue light source b included in eachlighting element may be the same or different. For example, one lightingelement may have more red light sources r than other lighting elements.In the embodiment, it is assumed that the same number of red lightsources r, green light sources g, and blue light sources b are arranged.

C. Hardware Configuration of Control Device 100

FIG. 5 is a schematic view illustrating a hardware configuration of thecontrol device. As illustrated in FIG. 5, control device 100 typicallyhas a structure according to a general-purpose computer architecture,and implements various processing as described later by the processorexecuting the previously-installed program.

More specifically, control device 100 includes a processor 110 such as acentral processing unit (CPU) or a micro-processing unit (MPU), a randomaccess memory (RAM) 112, a display controller 114, a system controller116, an input output (I/O) controller 118, a hard disk 120, a deviceinterface 122, an input interface 124, a communication interface 128,and a memory card interface 130. These units are data-communicablyconnected to each other around system controller 116.

Processor 110 exchanges a program (code) and the like with systemcontroller 116, and executes the program and the like in a predeterminedorder, thereby implementing target arithmetic processing.

System controller 116 is connected to processor 110, RAM 112, displaycontroller 114, input interface 124, and I/O controller 118 through abus, exchanges data with each unit, and controls the entire processingof control device 100.

RAM 112 is typically a volatile storage device such as a dynamic randomaccess memory (DRAM), and holds the program read from hard disk 120, thecamera image acquired by camera 8, a processing result for the image,work data including the imaging condition, and the like.

Display controller 114 is connected to display 101, and outputs a signalin order to display various information to display 101 according to aninternal command from system controller 116.

Input interface 124 is connected to touch panel 102, and transmitsvarious information input from touch panel 102 to system controller 116.

I/O controller 118 controls data exchange with a recording medium or anexternal device connected to control device 100. More specifically, I/Ocontroller 118 is connected to hard disk 120, device interface 122,communication interface 128, and memory card interface 130.

Hard disk 120 is typically a nonvolatile magnetic storage device, andstores various setting values and the like in addition to a controlprogram 150 executed by processor 110. Control program 150 installed inhard disk 120 is distributed while stored in a memory card 136 or thelike. A semiconductor storage device such as a flash memory or anoptical storage device such as a digital versatile disk random accessmemory (DVD-RAM) may be adopted instead of hard disk 120.

Image acquisition unit 210, evaluation algorithm selection unit 220,calculation unit 230, and lighting pattern determination unit 240 inFIG. 1 are implemented by processor 110 executing control program 150.

Device interface 122 mediates data transmission between camera 8 andlighting device 4 and processor 110. Device interface 122 outputs aninstruction according to the imaging condition instructed from processor110 to camera 8 and lighting device 4. Device interface 122 acquiresimage data obtained by imaging target W, and mediates data transmissionbetween processor 110 and camera 8.

Communication interface 128 mediates data transmission between processor110 and another personal computer (not illustrated), a server device, orthe like. Communication interface 128 typically includes Ethernet(registered trademark), a universal serial bus (USB), or the like.

Memory card interface 130 mediates data transmission between processor110 and memory card 136 that is the recording medium. Memory card 136 isdistributed while control program 150 and the like executed by controldevice 100 are stored in memory card 136, and memory card interface 130reads the control program from memory card 136. Memory card 136 includesa general-purpose semiconductor storage device such as a secure digital(SD), a magnetic recording medium such as a flexible disk, an opticalrecording medium such as a compact disk read only memory (CD-ROM), orthe like. Alternatively, the program downloaded from a distributionserver or the like may be installed in control device 100 throughcommunication interface 128.

When the computer having the structure following the general-purposecomputer architecture is used, an operating system (OS) providing abasic function of the computer may be installed in addition to theapplication providing the function of the embodiment. In this case,control program 150 of the embodiment may call a required module in apredetermined order and/or timing among program modules provided as apart of the OS to execute processing.

Furthermore, control program 150 of the embodiment may be provided whileincorporated in a part of another program. Also in this case, theprogram itself does not include modules included in another programcombined as described above, and the processing is executed incooperation with the other program. That is, the control program of theembodiment may be incorporated in such another program.

Alternatively, some or all of the functions provided by the execution ofthe control program 150 may be implemented as a dedicated hardwarecircuit.

D. Outline of Method for Determining Lighting Pattern

In the embodiment, control device 100 evaluates each evaluation lightingpattern based on evaluation image R acquired by imaging under mutuallydifferent evaluation lighting patterns, and determines the measurementlighting pattern to be used for the image measurement based on theevaluation result.

FIG. 6 is a flowchart illustrating a flow of the determination of themeasurement lighting pattern. Control device 100 acquires an evaluationimage Ri imaged under each evaluation lighting pattern xi (step S1).Control device 100 selects one target algorithm from a plurality ofevaluation algorithms (step S2).

Subsequently, control device 100 calculates evaluation value Pi ofevaluation lighting pattern xi using the target algorithm and evaluationimage Ri (step S3). Control device 100 determines the measurementlighting pattern based on evaluation value Pi for each evaluationlighting pattern xi (step S4).

E. Example of Evaluation Algorithm

An example of the evaluation algorithm will be described below. In thiscase, an evaluation algorithm calculating the evaluation valueindicating the adaptation of each evaluation lighting pattern to thedefect inspection image measurement will be described.

The lighting pattern obtaining an image in which the defect portion ismade conspicuous is preferable in order to inspect the defect of targetW. Accordingly, at least one defect region including the defect portionand at least one background region not including the defect portion arepreviously set for evaluation image R.

FIG. 7 is a view illustrating an example of the defect region and thebackground region set in the evaluation image. In evaluation image Rexemplified in FIG. 7, m defect regions H₀ to H_(m-1) and n backgroundregions h₀ to H_(n-1) are set. m and n may be an integer greater than orequal to 1. That is, the number of defect regions set in evaluationimage R is not particularly limited, and is one or greater than or equalto two. The number of background regions set in evaluation image R isnot particularly limited, and is one or greater than or equal to two.

Defect regions H₀ to H_(m-1) and background regions h₀ to h_(n-1) inFIG. 7 have the same shape and size. Specifically, defect regions H₀ toH_(m-1) and background regions h₀ to h_(n-1) have a rectangular shape inwhich a length in the x-axis direction is 1x and a length in the y-axisdirection is 1y. However, the shapes and sizes of defect regions H₀ toH_(m-1) and background regions h₀ to h_(n-1) may be different from eachother.

The position of each pixel constituting evaluation image R is indicatedby an xy-coordinate values in which an origin is the upper left cornerof evaluation image R. The coordinates of an upper left vertex of defectregion H_(p) are (X_(p),Y_(p)). The coordinates of the upper left vertexof background region h_(q) are (x_(q),y_(q)). Luminance (brightness) ofthe pixel in coordinates (x,y) is represented by f(x,y).

In the defect detection image measurement, the image processingemphasizing the defect portion is executed on the external appearanceimage, and the background is also emphasized depending on an imageprocessing technique. Accordingly, a first algorithm depending on thedifference between the defect region and the background region and asecond algorithm calculating the evaluation value depending on theuniformity of the background region are previously set.

The first algorithm and the second algorithm calculate an evaluationvalue E expressed by the following Formula (1). That is, the minimumvalue among (σ₀/σ′) to (σ_(m-1)/σ′) calculated for each of defectregions H₀ to H_(m-1) is calculated as evaluation value E.

[MathematicalFormula1] $\begin{matrix}{E = {\min_{p = 0}^{m - 1}\left( \frac{\sigma_{p}}{\sigma^{\prime}} \right)}} & {{Formula}(1)}\end{matrix}$

A numerator σ_(p) of Formula (1) is a value indicating a differencebetween defect region H_(p) and background regions h₀ to h_(n-1).Consequently, the first algorithm and the second algorithm can calculateevaluation value E depending on the difference between the defect regionand the background region. For example, σ_(p) satisfies the following

[MathematicalFormula2] $\begin{matrix}{\sigma_{p}^{2} = {\frac{1}{l_{x}l_{y}}{\sum\limits_{i = 0}^{l_{x} - 1}{\sum\limits_{j = 0}^{l_{y} - 1}{\left( {{f\left( {{X_{p} + i},{Y_{p} + j}} \right)} - b} \right)^{2}.}}}}} & {{Formula}(2)}\end{matrix}$

In Formula (2), b represents an average value of the luminance of pixelsconstituting background regions h₀ to h_(n-1), and is expressed by thefollowing Formula (3).

[MathematicalFormula3] $\begin{matrix}{b = {\frac{1}{nl_{x}l_{y}}{\sum\limits_{q = 0}^{n - 1}{\sum\limits_{i = 0}^{l_{x} - 1}{\sum\limits_{j = 0}^{l_{y} - 1}{f\left( {{x_{q} + i},{y_{q} + j}} \right)}}}}}} & {{Formula}(3)}\end{matrix}$

A denominator σ′ of Formula (1) indicates the uniformity of backgroundregions h₀ to h_(n-1). However, in the first algorithm, a predeterminedthreshold value κ is substituted for σ′. For example, κ is set to 1.Thus, when the first algorithm is used, evaluation value E that does notdepend on the uniformity of the background region is calculated.

In the second algorithm calculating evaluation value E depending on theuniformity of the background region, α′ is calculated as follows. Atthis point, a method for calculating α′ when a plurality of secondalgorithms having different contribution rates of the uniformity of thebackground region to evaluation value E is set will be described. Thecontribution ratio of the uniformity of the background region toevaluation value E is expressed by a background uniformity level λ. Thebackground uniformity level λ can take any integer from 1 to L. Forexample, L is 5. For the case of L=5, five second algorithmsrespectively corresponding to background uniformity levels λ=1 to 5 arepreviously set.

First, variance V of the luminance values of all the pixels belonging tobackground regions h₀ to h_(n-1) is calculated according to thefollowing Formula (4).

[MathematicalFormula4] $\begin{matrix}\begin{matrix}{V = {\frac{1}{nl_{x}l_{y}}{\sum\limits_{q = 0}^{n - 1}{\sum\limits_{i = 0}^{l_{x} - 1}{\sum\limits_{i = 0}^{l_{y} - 1}\left( {{f\left( {{x_{q} + i},{y_{q} + j}} \right)} - b} \right)^{2}}}}}} \\{= {{\frac{1}{nl_{x}l_{y}}{\sum\limits_{q = 0}^{n - 1}{\sum\limits_{i = 0}^{l_{x} - 1}{\sum\limits_{j = 0}^{l_{y} - 1}\left( {f\left( {{x_{q} + i},{y_{q} + j}} \right)} \right)^{2}}}}} - b^{2}}}\end{matrix} & {{Formula}(4)}\end{matrix}$

σ′ is calculated according to the following Formula (5) using variance Vcalculated according to Formula (4).

[MathematicalFormula5] $\begin{matrix}{\sigma^{\prime} = \left\{ \begin{matrix}{\kappa,} & {{\frac{\lambda}{L}\sqrt{V}} < \kappa} \\{{\frac{\lambda}{L}\sqrt{V}},} & {{\frac{\lambda}{L}\sqrt{V}} \geq \kappa}\end{matrix} \right.} & {{Formula}(5)}\end{matrix}$

As illustrated in Formula (5), when a value (λ/L)V^(1/2) according tovariance V is smaller than threshold value κ, σ′ is fixed (clipped) tothreshold value κ so as not to be smaller than threshold value κ. Thatis, when the value (λ/L)V^(1/2) corresponding to variance V is smallerthan threshold value κ, evaluation value E is calculated using thresholdvalue κ. On the other hand, when the value (λ/L)V^(1/2) corresponding tovariance V is greater than or equal to threshold value κ, σ′ isdetermined to be the value (λ/L)V^(1/2) corresponding to variance V.That is, when the value (λ/L)V^(1/2) corresponding to variance V isgreater than or equal to threshold value κ, evaluation value E iscalculated using (λ/L)V^(1/2). Threshold value κ is previously setaccording to the second algorithm, and for example, is 1.

As described above, in the second algorithm, evaluation value Edepending on variance V indicating the uniformity of the backgroundregion is calculated. Furthermore, as the background uniformity level λincreases (approaches L), denominator σ′ in Formula (1) increases(contribution ratio of the uniformity of the background region toevaluation value E increases).

The luminance of the pixels constituting the evaluation image isrepresented by a red component, a green component, and a blue component.Processor 110 calculates σ_(Rp) and σ′_(R) by substituting the luminanceof the red component into the above Formulas (2) to (5). Processor 110calculates σ_(Gp) and σ′_(G) by substituting the luminance of the greencomponent into the above Formulas (2) to (5). Processor 110 calculatesσ_(Bp) and σ′_(B) by substituting the luminance of the blue componentinto the above Formulas (2) to (5). Processor 110 may substituteσ_(Rp)+σ_(Gp)+σ_(Bp) into Formula (1) as σ_(p). Similarly, processor 110may substitute σ′_(R)+σ′_(G)+σ′_(B) into Formula (1) as σ′.

Evaluation value E calculated by Formula (1) increases as the adaptationto the image measurement increases. However, the evaluation value is notlimited to evaluation value E calculated according to Formula (1), butmay be smaller as the adaptation to the image measurement is higher.Evaluation value E calculated by Formula (1) will be described below asan example.

F. Example of Evaluation Lighting Pattern

When the brightness of each lighting element 40 can be adjusted to sevenlevels (including turn-off) and when the color of each lighting element40 can be adjusted to any one of seven colors of white, red, green,blue, cyan, magenta, and yellow, the lighting state that can be taken byeach lighting element 40 is 43 ways obtained by adding the turn-offstate to the turn-on state of 6×7=42 ways. When lighting device 4includes 13 lighting elements 40, the total number of lighting patternsin which lighting device 4 can take is as huge as 43¹³. Consequently, inthe embodiment, the lighting patterns that can be taken by lightingdevice 4 are previously divided into a plurality of groups, and thelighting pattern belonging to at least one group selected from theplurality of groups is determined as the evaluation lighting pattern.

FIG. 8 is a view illustrating the lighting pattern belonging to thefirst group. The first group in FIG. 8 includes a plurality of lightingpatterns in which the irradiation intensities in first radial directionD1 to fourth radial direction D4 are uniform.

As illustrated in FIG. 8, nine types of (b) to (j) exist in the firstgroup as the combination (hereinafter, referred to as an “elementcombination”) of lighting elements 40 to be turned on. In the elementcombination illustrated in (b), all lighting elements 40 are turned on.In the element combination illustrated in (c), lighting elements 42L to45L having a distance r3 from lighting element 41 (see FIG. 4) areturned on. In the element combination illustrated in (d), lightingelements 42M to 45M, 42L to 45L having distances r2, r3 (see FIG. 4)from lighting element 41 are turned on. In the element combinationillustrated in (e), lighting elements 40 other than central lightingelement 41 are turned on. In the element combination illustrated in (f),lighting elements 42M to 45M having distance r2 from lighting element 41(see FIG. 4) are turned on. In the element combination illustrated in(g), lighting elements 42U to 45U, 42M to 45M having distances r1, r2(see FIG. 4) from lighting element 41 are turned on. In the elementcombination illustrated in (h), only central lighting element 41 isturned on. In the element combination illustrated in (i), lightingelements 42U to 45U having distance r1 from lighting element 41 (seeFIG. 4) are turned on. In the element combination illustrated in (j),lighting elements 41, 42U to 45U are turned on. The brightness and colorof the lighting elements to be turned on are all adjusted to be thesame.

FIG. 9 is a view illustrating the lighting pattern belonging to thesecond group. The second group in FIG. 9 includes the plurality oflighting patterns in which only the lighting elements arranged in one offirst radial direction D1 to fourth radial direction D4 are turned on.

As illustrated in FIG. 9, the second group includes 16 types of elementcombinations (b) to (q). All of lighting elements 42L, 42M, 42U arrangedin first radial direction D1 (see FIG. 4) are turned on in the elementcombination illustrated in (b), and each of lighting elements 42L, 42M,42U is turned on in the element combinations illustrated in (c) to (e).All of lighting elements 43L, 43M, 43U arranged in second radialdirection D2 (see FIG. 4) are turned on in the element combinationillustrated in (f), and each of lighting elements 43L, 43M, 43U isturned on in the element combinations illustrated in (g) to (i). All oflighting elements 44L, 44M, 44U arranged in third radial direction D3(see FIG. 4) are turned on in the element combination illustrated in(j), and each of lighting elements 44L, 44M, 44U is turned on in theelement combinations illustrated in (k) to (m). All of lighting elements45L, 45M, 45U arranged in fourth radial direction D4 (see FIG. 4) areturned on in the element combination illustrated in (n), and each oflighting elements 45L, 45M, 45U is turned on in the element combinationsillustrated in (o) to (q). The brightness and color of the lightingelements to be turned on are all adjusted to be the same.

FIG. 10 is a view illustrating the lighting pattern belonging to thethird group. The third group in FIG. 10 includes the plurality oflighting patterns in which only lighting elements arranged along a pairof radial directions opposite to each other in first radial direction D1to fourth radial direction D4 are turned on.

As illustrated in FIG. 10, the third group includes 12 types of elementcombinations (b) to (m). Specifically, in the element combinationsillustrated in (b) to (g), the selected lighting elements among lightingelements 42L, 42M, 42U arranged in first radial direction D1 (see FIG.4) and lighting elements 44L, 44M, 44U arranged in third radialdirection D3 are turned on. The lighting element to be turned on amonglighting elements 44L, 44M, 44U is symmetrical to the lighting elementto be turned on among lighting elements 42L, 42M, 42U with respect tocentral lighting element 41. In the element combinations illustrated in(h) to (m), the selected lighting elements among lighting elements 43L,43M, 43U arranged in second radial direction D2 (see FIG. 4) andlighting elements 45L, 45M, 45U arranged in fourth radial direction D4are turned on. The lighting element to be turned on among lightingelements 43L, 43M, 43U, is symmetrical to lighting element to be turnedon among lighting elements 45L, 45M, 45U with respect to centrallighting element 41. The brightness and color of the lighting elementsto be turned on are all adjusted to be the same.

When the plurality of lighting elements 40 are radially arranged alongthe first to Nth radial directions at equal angular intervals, the thirdgroup in which only the lighting elements arranged along the pair ofradial directions opposite to each other are turned on can be set aslong as N is an even number greater than or equal to four. The secondgroup in which only one radially arranged lighting element is turned oncan be set as long as N is an integer greater than or equal to two.

G. Setting Screen for Optimization of Lighting Pattern

With reference to FIG. 11, an example of the setting screen optimizingthe lighting pattern will be described. FIG. 11 is a view illustratingan example of the setting screen optimizing the lighting pattern.

A setting screen 60 in FIG. 11 is displayed on display 101 by processor110 executing control program 150. The input to setting screen 60 isexecuted using touch panel 102. That is, processor 110 executesprocessing according to the input to touch panel 102 that is a userinterface.

Setting screen 60 in FIG. 11 includes three tabs 61 to 63. Tab 61 isselected when the defect region is set. Tab 62 is selected when variousmeasurement parameters for optimization are set. Tab 63 is selected whenan output condition of information indicating the measurement lightingpattern determined by the optimization is set. FIG. 11 illustratessetting screen 60 when tab 62 is selected.

Setting screen 60 includes an input field 64 in which an evaluationalgorithm is selected. One of integers from 0 to L can be input to inputfield 64. At this point, “0” is input when the first algorithm isselected. The integer of any one of 1 to L is input when the secondalgorithm is selected. “1” to “L” input to input field 64 indicate thebackground uniformity level λ. Processor 110 selects the targetalgorithm from the first algorithm and the L types of second algorithmsaccording to the input to input field 64.

Setting screen 60 includes an input field 65 and check boxes 66 to 68 inwhich the evaluation lighting pattern is selected among the lightingpatterns that can be taken by lighting device 4.

Check boxes 66, 67 are boxes in which one of the first to third groupsin FIGS. 8 to 10 is selected. When neither of check boxes 66, 67 ischecked, the first group in FIG. 8 is selected. When check box 66 ischecked while check box 67 is not checked, the first group in FIG. 8 andthe third group in FIG. 10 are selected. When check box 66 is notchecked while check box 67 is checked, the first group in FIG. 8 and thesecond group in FIG. 9 are selected. When both check boxes 66, 67 arechecked, all of the first to third groups are selected.

Check box 68 is used to set the emission color of lighting element 40 tobe turned on. When check box 68 is not checked, the emission color oflighting element 40 to be turned on is set to only white. When check box68 is checked, the emission color of lighting element 40 to be turned onis adjusted to six colors of red, green, blue, cyan, magenta, and yellowother than white.

Input field 65 is used to set a variation width of the brightness oflighting element 40 to be turned on. For example, when the brightness ofeach lighting element 40 is adjustable in 127 steps and when “20” isinput in input field 65, the brightness of lighting element 40 to beturned on is adjusted in 6 steps of “20”, “40”, “60”, “80”, “100”, and“120”. When “30” is input in input field 65, the brightness of lightingelement 40 to be turned on is adjusted in four stages of “30”, “60”,“90”, and “120”.

For example, when check boxes 66 to 68 are not checked and when “20” isinput to input field 65, the brightness is sequentially adjusted to sixlevels for each of the nine types of element combinations (b) to (j) inFIG. 8. Consequently, processor 110 selects the lighting patterns of9×6=54 as the evaluation lighting pattern.

When only check box 66 is checked and when “20” is input to input field65, the brightness is sequentially adjusted to six levels for each ofthe 9 types of element combinations of (b) to (j) in FIG. 8 and the 12types of element combinations of (b) to (m) in FIG. 10. Consequently,processor 110 selects the lighting patterns of 21×6=126 as theevaluation lighting pattern.

When only check box 68 is checked and when “20” is input to input field65, for each of the nine types of element combinations of (b) to (j) inFIG. 8, the brightness is sequentially adjusted to six levels ofbrightness and six types of emission colors are sequentially adjusted.Consequently, processor 110 selects the lighting patterns of 9×6×6=324as the evaluation lighting pattern.

Setting screen 60 includes a button 69 adding the defect region, abutton 70 adding the background region, and a button 71 deleting thedefect region or the background region. Details of processing ofprocessor 110 when buttons 69 to 71 are operated will be describedlater.

Setting screen 60 includes a button 72 starting processing ofdetermining a measurement lighting pattern optimal for the imagemeasurement from the evaluation lighting patterns. When button 72 isoperated, processor 110 causes lighting device 4 to emit theillumination light according to each of the plurality of evaluationlighting patterns determined according to the operation of input field65 and check boxes 66 to 68, and acquires the evaluation imagecorresponding to each evaluation lighting pattern from camera 8.Processor 110 calculates evaluation value E for each evaluation lightingpattern using the acquired evaluation image and the target algorithmselected according to the input to input field 64.

Processor 110 calculates evaluation value E each time the evaluationimage is acquired, and displays calculated evaluation value E in adisplay field 73. When the calculation of evaluation values E for allthe evaluation lighting patterns is ended, processor 110 displaysmaximum evaluation value E and a lighting pattern number identifying theevaluation lighting pattern in which maximum evaluation value E iscalculated in a display field 74.

Processor 110 repeats the calculation of evaluation value E each timebutton 72 is operated. Thus, a plurality of evaluation values E areobtained for the same sample or different samples.

Setting screen 60 includes a button 76 switching the display content ofa region 75. Either the evaluation image acquired from camera 8 or alist of evaluation values E calculated by processor 110 is displayed inregion 75. When button 76 is operated while the evaluation image isdisplayed, processor 110 switches the display content of region 75 tothe list of evaluation values E. When button 76 is operated while thelist of evaluation values E is displayed, processor 110 switches thedisplay content of region 75 to the evaluation image.

Setting screen 60 includes a button 77 deleting unnecessary data.Processor 110 deletes data designated in the list of evaluation values Edisplayed in region 75.

Setting screen 60 includes check boxes 78, 79 selecting one of theplurality of evaluation lighting patterns and an input field 80. Whenone of check boxes 78, 79 is checked, processor 110 receives the inputto input field 80. Processor 110 sorts the list of evaluation values Edisplayed in region 75 in order of the magnitude of evaluation value Ein response to the check of check box 79.

Processor 110 displays the evaluation image corresponding to theevaluation lighting pattern of the lighting pattern number input toinput field 80 in region 75. Furthermore, processor 110 displays aschematic view illustrating the position of lighting element 40 to beturned on in the evaluation lighting pattern of the lighting patternnumber input to input field 80 in a region 81. Furthermore, processor110 displays evaluation value E calculated for the evaluation lightingpattern of the lighting pattern number input to input field 80 indisplay field 73. Thus, the user can easily check evaluation value E,the evaluation image, and the position of lighting element 40 to beturned on corresponding to each evaluation lighting pattern.

Setting screen 60 includes a check box 82 performing logging of theevaluation image. When check box 82 is checked, processor 110 stores theacquired evaluation image in a storage area.

Setting screen 60 includes a region 83 executing storage of data ofcalculated evaluation value E. A storage folder and a storage file nameare specified in region 83. When finishing the calculation of evaluationvalue E for each evaluation lighting pattern according to the operationof button 72, processor 110 generates evaluation value data indicatingthe list of calculated evaluation values E. Processor 110 assigns thefile name designated in region 83 to the generated evaluation valuedata, and stores the evaluation value data in the folder designated inregion 83. Details of the evaluation value data will be described later.

When check box 82 is checked, the evaluation image is also stored in thestorage folder designated in region 83.

Further, setting screen 60 includes a button 84 performing testmeasurement and a region 85 inputting a determination condition.Processor 110 issues an error notification when evaluation value E doesnot satisfy the determination condition input to region 85. When theerror notification is unnecessary, the entire range that can be taken byevaluation value E may be set to region 85.

Setting screen 60 includes an OK button 86 and a cancel button 87. Inresponse to the operation of OK button 86, processor 110 determines theevaluation lighting pattern corresponding to evaluation value E (maximumevaluation value) having the highest adaptation as the measurementlighting pattern. In response to the operation of cancel button 87,processor 110 ends the processing without reflecting the result of theoperation on setting screen 60 in the setting of lighting device 4.

H. Setting of Defect Region and Background Region

With reference to FIGS. 12 to 16, a method for setting the defect regionand the background region will be described below. FIG. 12 is a viewillustrating an example of the setting screen when tab 61 setting thedefect region is operated.

As illustrated in FIG. 12, when tab 61 is operated, processor 110displays the sample image acquired from camera 8 in region 75 of settingscreen 60. The user installs the sample of target W before operating tab61. Thus, a sample image S corresponding to the sample is displayed inregion 75 of setting screen 60. Sample image S in FIG. 12 has a defectportion 90.

Setting screen 60 includes an edit button 91 editing the defect region.When edit button 91 is operated, processor 110 starts the edition of thedefect region.

FIG. 13 is a view illustrating an example of the setting screen when theedit button in FIG. 12 is operated. Setting screen 60 in FIG. 13includes a region shape selection button group 92 and a size editingregion 93. When a button included in region shape selection button group92 is operated, processor 110 displays a frame line 94 having a shape(quadrangle, circle, fan, and the like) corresponding to the button soas to be superimposed on sample image S. Frame line 94 indicates therange of the defect region.

Furthermore, in response to the operation on a button and/or an inputbox included in size editing region 93, processor 110 edits the positionand size of frame line 94. Processor 110 may display a change button 95changing the position or size of frame line 94, and change the positionand size of frame line 94 according to the operation on change button95.

FIG. 14 is a view illustrating an example of the setting screen afterthe position and the size of the frame line indicating a range of thedefect region are changed. As illustrated in FIG. 14, the user adjuststhe position and size of frame line 94 such that defect portion 90 fallsinto frame line 94.

When an OK button 96 is operated, processor 110 sets the regionsurrounded by frame line 94 as the defect region. On the other hand,when a cancel button 97 is operated, processor 110 deletes the databeing edited.

FIG. 15 is a view illustrating an example of the setting screen when thebackground region is set. Setting screen 60 in FIG. 15 is displayed inresponse to the operation of tab 62 after the setting of the defectregion. When button 70 adding the background region is operated,processor 110 displays a frame line 98 a having the same shape and sizeas frame line 94 indicating the range of the set defect region whilesuperimposing frame line 98 a on sample image S. Frame line 98 aindicates a range of one background region. Processor 110 receives adrag operation on frame line 98 a, and moves frame line 98 a accordingto the drag operation. The user may move frame line 98 a such that frameline 98 a does not include the defect portion. Processor 110 sets theregion surrounded by frame line 98 a as the background region. In thismanner, the user can set the background region only by appropriatelysetting the position of frame line 98 a.

FIG. 16 is a view illustrating another example of the setting screenwhen an additional background region and an additional defect region areset. Frame lines 98 a, 98 b setting the background region are displayedon setting screen 60 in FIG. 16. Every time button 70 is operated,processor 110 displays frame line 98 setting the background region whilesuperimposing frame line 98 on sample image S, and sets the regionsurrounded by each frame line 98 (98 a, 98 b) as the background region.Depending on sample image S, the brightness, the contrast, and the likemay change according to the position. Thus, the user sets a plurality ofbackground regions arranged at different positions.

When sample image S includes a plurality of defect portions, the usermay operate button 69 adding the defect region. In response to theoperation of button 69, processor 110 displays a frame line 94 a havingthe same shape and size as frame line 94 indicating the range of the setdefect region while superimposing frame line 94 a on sample image S. Theuser changes the position and size of frame line 94 a. Processor 110sets the range surrounded by frame line 94 a as a range of a new defectregion.

Furthermore, when a button 71 is operated while any one of frame lines94 a, 98 a, 98 b is selected, processor 110 deletes the selected frameline. Thus, the user can delete the unnecessary frame line.

I. Evaluation Value Data

FIG. 17 is a view illustrating an example of the evaluation value data.As illustrated in FIG. 17, the evaluation value data is data in whichthe lighting pattern number identifying the evaluation lighting pattern,detailed information about the evaluation lighting pattern, andevaluation value E are associated for each evaluation lighting pattern.The detailed information indicates the lighting element to be turned on,the brightness of the lighting element, and the emission color of thelighting element. As described above, when a button 72 (see FIG. 11) ofsetting screen 60 is operated a plurality of times, the evaluation imageis acquired each time the button is operated, and evaluation value E iscalculated for the acquired evaluation image. Accordingly, theevaluation value data indicates evaluation value E of each time.

When a button 76 is operated on setting screen 60 in FIG. 11, processor110 displays the list of evaluation values E in region 75 of settingscreen 60 based on the evaluation value data.

FIG. 18 is a view illustrating the list of evaluation values displayedon the setting screen. (a) of FIG. 18 illustrates the list of evaluationvalues E when check box 79 is not checked on setting screen 60 in FIG.11, and (b) of FIG. 18 illustrates the list of evaluation values E whencheck box 79 is checked. FIG. 18 illustrates the list of eightevaluation values E (“Data 0” to “Data 7”) calculated according to eightoperations to button 72 (see FIG. 11) on setting screen 60. “P-No.”indicates the lighting pattern number identifying the evaluationlighting pattern.

As illustrated in (a) of FIG. 18, evaluation value E is displayed in theorder of the lighting pattern number. Thus, the user can grasp theadaptation of each evaluation lighting pattern to the image measurement.By checking check box 79, the user can sort evaluation values E indescending order as illustrated in FIG. 18(b). Thus, the evaluationlighting pattern having the high adaptation to image measurement can beeasily specified.

When the evaluation value data includes the plurality of evaluationvalues E for each evaluation lighting pattern, processor 110 performsthe sorting according to the following procedure. Processor 110 extractsthe evaluation value (minimum evaluation value) having the lowestadaptation to the image measurement from among the plurality ofevaluation values E for each evaluation lighting pattern. Processor 110rearranges the lighting pattern numbers and the evaluation values indescending order of the adaptation to the image measurement based on theextracted minimum evaluation value. That is, processor 110 rearrangesthe lighting pattern numbers and the evaluation values in descendingorder of the minimum evaluation value.

That is, when acquiring the plurality of evaluation images for eachevaluation lighting pattern, processor 110 calculates evaluation value Efor each of the plurality of evaluation images. Then, processor 110extracts the evaluation value (hereinafter, referred to as a “lowestevaluation value”) having the lowest adaptation from the evaluationvalues E for the plurality of evaluation images for each evaluationlighting pattern. Processor 110 determines the evaluation lightingpattern in which the lowest evaluation value having the highestadaptation is extracted from the plurality of evaluation lightingpatterns as the measurement lighting pattern.

J. Processing Example of Optimization of Lighting Pattern

With reference to FIGS. 19 to 22, a processing example of optimizationof the lighting pattern will be described below. FIG. 19 is an enlargedview illustrating a part of four evaluation images obtained under thelighting of four evaluation lighting patterns having differentbrightness. (a) to (d) of FIG. 19 illustrate the evaluation imagescorresponding to lighting pattern Nos. 29, 7, 44, and 40, respectively.(a) of FIG. 19 illustrates a relatively dark evaluation image with a lowbackground uniformity. On the other hand, the brightness increases inthe order of (b) to (d) of FIG. 19, and the uniformity of the backgroundincreases. However, as the uniformity of the background increases, thedifference between defect portion 90 and the background decreases.

FIG. 20 is a view illustrating the value of σ′ calculated from theevaluation image in FIG. 19. FIG. 20 illustrates the value of σ′ whenthreshold value κ is set to 1. In FIG. 20, “λ=0” indicates the firstalgorithm calculating the evaluation value that depends on thedifference between the defect region and the background region and doesnot depend on the uniformity of the background region. That is, σ′ isfixed to threshold value κ (=1) for all the evaluation lightingpatterns. On the other hand, “λ=1” to “λ=5” indicate the secondalgorithms when the background uniformity level λ, is set to 1 to 5.

σ′ corresponding to the lighting pattern No. 29 takes a value largerthan threshold value κ (=1) even when the background uniformity level λis set to 1 because the uniformity of the background in the evaluationimage is low (see (a) of FIG. 19), and α′ corresponding to the lightingpattern No. 29 increases as the background uniformity level λ increases.

The uniformity of the background in the evaluation image correspondingto the lighting pattern Nos. 7, 44 is higher than the uniformity of thebackground in the evaluation image corresponding to the lighting patternNo. 29 (see (b) and (c) of FIG. 19). Consequently, a′ corresponding tothe lighting pattern Nos. 7, 44 is fixed to threshold value κ (=1) atthe background uniformity level λ=1, 2, and takes a value larger thanthreshold value κ when the background uniformity level λ is at least 3.The uniformity of the background in the evaluation image correspondingto lighting pattern No. 44 is higher than the uniformity of thebackground in the evaluation image corresponding to the lighting patternNo. 7. Consequently, when the background uniformity level λ is 3 ormore, σ′ corresponding to the lighting pattern No. 44 is smaller than σ′corresponding to the lighting pattern No. 7.

The uniformity of the background in the evaluation image correspondingto lighting pattern No. 40 is higher than the uniformity of thebackground in the evaluation image corresponding to lighting pattern No.44 (see (d) of FIG. 19). Consequently, α′ corresponding to lightingpattern No. 40 is fixed to threshold value κ (=1) at all backgrounduniformity levels λ.

FIG. 21 is a view illustrating evaluation value E calculated from theevaluation image in FIG. 19. FIG. 21 illustrates evaluation value E whenthreshold value x is set to 1.

When the first algorithm (λ=0) is selected as the target algorithm,evaluation value E corresponding to the lighting pattern No. 29 ismaximized, and the lighting pattern No. 29 is determined as themeasurement lighting pattern. As illustrated in FIG. 20, α′ depending onthe uniformity of the background is fixed to threshold value κ (=1) forall the evaluation lighting patterns. Consequently, evaluation value Edepends only on σ_(p) of the numerator according to the above Formula(1). σ_(p) is a value indicating the difference between the defectregion and the background region. Accordingly, evaluation value Ecorresponding to the lighting pattern No. 29 in which the evaluationimage having the large difference between the defect portion and thebackground is obtained is maximized.

When the second algorithm of the background uniformity level λ=1, 2 isselected as the target algorithm, evaluation value E corresponding tothe lighting pattern No. 7 is maximized, and the lighting pattern No. 7is determined as the measurement lighting pattern. As illustrated inFIG. 20, σ′ corresponding to the lighting pattern No. 29 is larger thanthreshold value κ (=1) at background uniformity levels λ=1, 2. σ′ is adenominator of the above Formula (1). Consequently, evaluation value Ecorresponding to the lighting pattern No. 29 becomes small, andevaluation value E corresponding to the lighting pattern No. 7 in whichσ_(p) indicating the difference between the defect region and thebackground region is the next largest becomes maximum.

When the second algorithm of the background uniformity level λ=3, 4 isselected as the target algorithm, evaluation value E corresponding tothe lighting pattern No. 44 is maximized, and the lighting pattern No.44 is determined as the measurement lighting pattern. As illustrated inFIG. 20, σ′ corresponding to the lighting pattern No. 7 is larger thanthreshold value κ (=1) at background uniformity levels λ=3, 4.Consequently, evaluation value E corresponding to the lighting patternNo. 7 decreases. σ′ corresponding to the lighting pattern No. 44 havingthe next largest σ_(p) is also larger than threshold value κ (=1), butsmaller than σ′ corresponding to the lighting pattern No. 7.Consequently, evaluation value E corresponding to the lighting patternNo. 44 is maximized.

When the second evaluation algorithm of the background uniformity levelλ=5 is selected as the target algorithm, evaluation value Ecorresponding to the lighting pattern No. 40 is maximized, and thelighting pattern No. 40 is determined as the measurement lightingpattern. As illustrated in FIG. 20, at the background uniformity levelλ=5, only σ′ corresponding to the lighting pattern No. 40 is fixed tothreshold value κ (=1), and σ′ corresponding to another evaluationlighting pattern is considerably larger than threshold value κ (=1).Consequently, evaluation value E corresponding to the lighting patternNo. 40 is maximized.

As described above, the evaluation lighting pattern in which maximumevaluation value E is maximized is different according to the selectedtarget algorithm. Consequently, the lighting pattern suitable for theimage measurement can be determined as the measurement lighting patternby selecting the evaluation algorithm according to the imagemeasurement.

FIG. 22 is a view illustrating a result of the image processingperformed on the evaluation image in FIG. 19. (a) to (d) of FIG. 22illustrate images after Sobel filter processing is performed as theimage processing. (e) to (h) of FIG. 22 illustrate images after Houghtransform processing is performed as the image processing. (a) and (e)of FIG. 22 illustrate images after the image processing is performed onthe evaluation image corresponding to the lighting pattern No. 29. (b)and (f) of FIG. 22 illustrate images after the image processing isperformed on the evaluation image corresponding to the lighting patternNo. 7. (c) and (g) of FIG. 22 illustrate images after the imageprocessing is performed on the evaluation image corresponding to thelighting pattern No. 44. (d) and (h) of FIG. 22 illustrate images afterthe image processing is performed on the evaluation image correspondingto the lighting pattern No. 40.

As illustrated in FIG. 22, when the Sobel filter processing isperformed, even an edge included in the background is emphasized. As aresult, when the image having the low uniformity of the background isused, it becomes difficult to distinguish between the defect portion andthe background, and the defect portion cannot be accurately detected.Consequently, when the image measurement including the Sobel filterprocessing is performed, the user may select the second algorithm of thebackground uniformity level λ=5. As a result, the lighting pattern No.40 having the high uniformity of the background is determined as themeasurement lighting pattern.

On the other hand, when the Hough transform processing is performed, theinfluence is almost not on the background, but the defect portion tendsto be thin. As a result, when the image having the small differencebetween the defect portion and the background is used, the defectportion cannot be accurately detected. Consequently, when the imagemeasurement including the Hough transform processing is performed, theuser may select the first algorithm. As a result, the lighting patternNo. 29 having the large difference between the defect portion and thebackground is determined as the measurement lighting pattern.

K. Action and Effect

As described above, image processing system 1 of the embodiment performsthe image measurement using the external appearance image of target W.Image processing system 1 includes camera 8 that images target W andlighting device 4 that includes the plurality of lighting elements 40that irradiates target W with light and is capable of adjusting at leastone of the emission intensity and the emission color for each lightingelement 40. Image processing system 1 further includes image acquisitionunit 210, evaluation algorithm selection unit 220, calculation unit 230,and lighting pattern determination unit 240. Image acquisition unit 210emits the illumination light from lighting device 4 according to each ofthe plurality of evaluation lighting patterns different from each other,and acquires at least one evaluation image corresponding to eachevaluation lighting pattern from camera 8. Evaluation algorithmselection unit 220 selects one target algorithm from the plurality ofevaluation algorithms. For each evaluation lighting pattern, calculationunit 230 calculates the evaluation value indicating the adaptation tothe image measurement using the target algorithm and the evaluationimage corresponding to the evaluation lighting pattern. Lighting patterndetermination unit 240 determines the lighting pattern to be used forthe image measurement from among the plurality of evaluation lightingpatterns based on the evaluation value.

According to the above configuration, the evaluation algorithm suitablefor the image measurement is selected from the plurality of evaluationalgorithms, so that the lighting pattern optimal for the imagemeasurement is automatically determined as the measurement lightingpattern. Thus, the lighting setting of the illumination can be easilyperformed so as to be suitable for the image measurement using theexternal appearance image of target W.

The plurality of evaluation algorithms includes the first algorithm thatoutputs the evaluation value depending on the difference between atleast one defect region and at least one background region in theevaluation image and at least one second algorithm that outputs theevaluation value depending on the uniformity of at least one backgroundregion.

As described above, in the image measurement detecting the defect on thesurface of target W, the image processing is performed in order toemphasize the defect portion. When the image processing capable ofemphasizing the background together with the defect portion isperformed, the lighting pattern in which the background is as uniform aspossible is preferable. In such a case, the second algorithm is selectedas the target algorithm, so that the lighting pattern that makes thebackground uniform can be determined as the measurement lightingpattern.

On the other hand, when the image processing in which the background isnot so emphasized is performed, the lighting pattern in which thedifference between the defect region and the background region increasesis preferable. In such a case, the first algorithm is selected as thetarget algorithm, so that the lighting pattern in which the differencebetween the defect region and the background region increases can bedetermined as the measurement lighting pattern.

The at least one second algorithm includes a plurality of secondalgorithms having different contribution rates of the uniformity of thebackground to the evaluation value.

According to the above configuration, the second algorithm having thecontribution rate suitable for the image measurement can beappropriately selected from the plurality of second algorithms. Thus,the lighting pattern suitable for the image measurement is determined asthe measurement lighting pattern.

The second algorithm calculates the evaluation value using thresholdvalue κ when the value (for example, (λ/L)V^(1/2)) corresponding tovariance V of the luminance of the plurality of pixels belonging to thebackground region is smaller than threshold value κ. The secondalgorithm calculates the evaluation value using the value (for example,(λ/L)V^(1/2)) corresponding to variance V when the value (for example,(λ/L)V^(1/2)) corresponding to variance V is greater than or equal tothreshold value κ. Threshold value κ is set according to the secondalgorithm.

When the evaluation value is calculated using variance V, the influencedegree of variance V on the evaluation value increases as variance Vapproaches zero. For example, when the evaluation value is calculated bya formula including variance V as the denominator, the evaluation valueapproaches infinity as variance V approaches zero. However, according tothe above configuration, the evaluation value is calculated usingthreshold value κ when the uniformity of the background is high to someextent, and the evaluation value is calculated using the valuecorresponding to variance V when the uniformity of the background islow. Thus, the appropriate evaluation value is calculated.

Image processing system 1 further includes touch panel 102 as a userinterface. Calculation unit 230 determines the shape, size, and positionof the defect region according to the input to touch panel 102.Furthermore, calculation unit 230 sets the same shape and size of thebackground region as the shape and size of the defect region, anddetermines the position of the background region according to the inputto touch panel 102. Thus, the user does not need to set the shape andsize of the background region by setting the shape, size, and positionof the defect region. As a result, labor required for setting thebackground region is reduced.

Calculation unit 230 calculates the evaluation value for each of theplurality of evaluation images. Lighting pattern determination unit 240extracts the lowest evaluation value having the lowest adaptation fromthe evaluation values for the plurality of evaluation images for eachevaluation lighting pattern. Lighting pattern determination unit 240determines the evaluation lighting pattern in which the lowestevaluation value having the highest adaptation is extracted from theplurality of evaluation lighting patterns as the measurement lightingpattern. Thus, the evaluation lighting pattern stably having the highadaptation is determined as the measurement lighting pattern.

The plurality of lighting patterns that can be taken by lighting device4 are previously divided into a plurality of groups. Image acquisitionunit 210 selects at least one group from the plurality of groups, anddetermines the plurality of lighting patterns belonging to the selectedat least one group as a plurality of evaluation lighting patterns. Thus,even when the total number of lighting patterns that can be taken bylighting device 4 is enormous, the group suitable for the imagemeasurement is selected, so that the time required for determining themeasurement lighting pattern can be shortened.

For example, the plurality of lighting elements 40 are radially arrangedalong the first to Nth radial directions at equal angular intervals. Nis an integer greater than or equal to 2. The plurality of groupsinclude a first group including the plurality of lighting patterns inwhich the irradiation intensity of the first to Nth radial directions isuniform and a second group including the plurality of lighting patternsin which only the lighting element disposed in one of the first to Nthradial directions is turned on.

According to the above configuration, the target is installed near thecenter of the plurality of radially-arranged lighting elements 40 toselect the first group, so that the irradiation direction of theillumination light to the target becomes uniform. Accordingly, the firstgroup may be selected in the case of performing the image measurement inwhich the irradiation direction of the illumination light is preferablyuniform. On the other hand, the second group may be selected in the caseof performing the image measurement in which deviation in theirradiation direction of the illumination light is preferable.

The plurality of groups may further include a third group including theplurality of lighting patterns in which only lighting elements arrangedalong a pair of radial directions opposite to each other in the first toNth radial directions are turned on. N is an integer greater than orequal to 4.

In addition, the plurality of groups may include a group including theplurality of lighting patterns in which the emission color of theplurality of lighting elements is white and a group including theplurality of lighting patterns in which the emission color of theplurality of lighting elements is a color other than white.

Evaluation algorithm selection unit 220 selects the target algorithmaccording to the input to touch panel 102. Thus, the user can select theevaluation algorithm suitable for the image measurement as the targetalgorithm.

L. Modifications First Modification

In the above description, processor 110 (evaluation algorithm selectionunit 220) selects the target algorithm according to the input to touchpanel 102. However, processor 110 (evaluation algorithm selection unit220) may automatically select the target algorithm according to theimage measurement to be executed.

For example, control device 100 previously stores a table in which typeinformation indicating the type is associated with identificationinformation identifying the evaluation algorithm suitable for the typefor each type of the image measurement. The table is previously producedby an experiment or the like. Processor 110 (evaluation algorithmselection unit 220) may read the identification informationcorresponding to the type of the image measurement to be executed fromthe table, and select the evaluation algorithm identified by the readidentification information as the target algorithm.

Second Modification

The method for calculating the evaluation value is not limited to theabove method. For example, when all of the defect regions and thebackground regions have the same shape and the same size, σ_(p) inFormula (1) may be calculated using the following Formula (6) instead ofFormula (2).

[MathematicalFormula6] σ p 2 = 1 l x ⁢ l y ⁢ ∑ i = 0 l x - 1 ∑ i = 0 l y -1 ( f ⁡ ( X p + i , Y p + j ) - b ⁡ ( i , j ) ) 2 Formula ⁢ ( 6 )

b(i,j) represents an average value of the luminance values of the pixels(i,j) in the background regions h₀ to h_(n-1) in Formula (7), and isrepresented by the following Formula (7).

[MathematicalFormula7] $\begin{matrix}{{b\left( {i,j} \right)} = {\frac{1}{n}{\sum\limits_{q = 0}^{n - 1}{f\left( {{x_{q} + i},{y_{q} + j}} \right)}}}} & {{Formula}(7)}\end{matrix}$

Furthermore, variance V of the luminance values of all the pixelsbelonging to the background regions h₀ to h_(n-1) may be calculatedaccording to the following Formula (8) instead of Formula (4).

[MathematicalFormula8] $\begin{matrix}{V = {\frac{1}{nl_{x}l_{y}}{\sum\limits_{q = 0}^{n - 1}{\sum\limits_{i = 0}^{l_{x} - 1}{\sum\limits_{j = 0}^{l_{y} - 1}\left( {{f\left( {{x_{q} + i},{y_{q} + j}} \right)} - {b\left( {i,j} \right)}} \right)^{2}}}}}} & {{Formula}(8)}\end{matrix}$

σ′ is calculated according to the above Formula (5) using variance Vcalculated according to Formula (8). Alternatively, σ_(p) in Formula (1)may be calculated using the following Formula (9) instead of Formula(2).

[MathematicalFormula9] $\begin{matrix}{\sigma_{p}^{2} = {\frac{1}{l_{x}l_{y}}{\sum\limits_{i = 0}^{l_{x} - 1}{\sum\limits_{j = 0}^{l_{y} - 1}\left( {{f\left( {{X_{p} + i},{Y_{p} + j}} \right)} - a} \right)^{2}}}}} & {{Formula}(9)}\end{matrix}$

In Formula (9), a represents an average value of the luminance in thedefect region H_(p), and is represented by the following Formula (10).

[MathematicalFormula10] $\begin{matrix}{a = {\frac{1}{l_{x}l_{y}}{\sum\limits_{i = 0}^{l_{x} - 1}{\sum\limits_{j = 0}^{l_{y} - 1}{f\left( {{X_{p} + i},{Y_{p} + j}} \right)}}}}} & {{Formula}(10)}\end{matrix}$

σ_(p) calculated using Formula (9) represents a standard deviation inthe defect region H_(p). Because the defect region H_(p) includes thedefect portion, σ_(p) increases in the lighting pattern in which thedefect portion is conspicuous, and the evaluation value also increases.

Third Modification

In the above description, for example, threshold value κ is previouslyset to 1. However, threshold value κ may be set according to theevaluation image corresponding to the evaluation lighting pattern. Forexample, threshold value κ is set as follows.

Processor 110 (calculation unit 230) calculates variance V for eachevaluation lighting pattern according to the above Formula (4) orFormula (8). Then, processor 110 (calculation unit 230) may determinethreshold value κ so as to satisfy, for example, both of the followingconditions a, b. When a plurality of values can be taken as thresholdvalue κ, for example, a median value of the plurality of values isdetermined as threshold value κ. (Condition a) (1/L)V^(1/2)≥κ issatisfied in 2% to 20% of the evaluation lighting patterns of all theevaluation lighting patterns.

(Condition b) V^(1/2)≥κ is satisfied in 80% to 100% of all evaluationlighting patterns.

Alternatively, processor 110 (calculation unit 230) may determinethreshold value κ according to the input to touch panel 102. Thus, theuser can set threshold value κ to a desired value.

Fourth Modification

In the above description, the plurality of evaluation algorithms includethe first algorithm that calculates the evaluation value depending onthe difference between the defect region and the background region andthe second algorithm that calculates the evaluation value depending onthe uniformity of the background region. However, the plurality ofalgorithms are not limited to these algorithms.

For example, the plurality of evaluation algorithms may calculate theevaluation value indicating an edge-likelihood of the pixel belonging tothe designated region in the evaluation image using different edgepatterns. The evaluation value indicating the edge-likeness iscalculated using, for example, the method disclosed in Japanese PatentLaying-Open No. 7-220058 (PTL 2).

FIG. 23 is a view illustrating an example of eight edge patterns. Asillustrated in FIG. 23, a window of 3×3=9 pixels is set for each edgepattern. Processor 110 (calculation unit 230) superimposes the window on3×3 pixels in the evaluation image, and calculates the adaptationbetween the edge pattern and the image data in the window. Processor 110(calculation unit 230) calculates the adaptation while moving the windowin the horizontal direction and the vertical direction in the designatedregion of the evaluation image, and calculates a total value of thecalculated adaptation. The designated region may be the entire region ora partial region of the evaluation image. The calculated total value ofthe adaptation represents the edge-likeness of the pixels belonging tothe designated region.

Processor 110 (calculation unit 230) calculates a luminance difference Q(brightness difference) between the center pixel and each of the eightperipheral pixels in the window. Calculation unit 230 calculates theadaptation as follows using luminance difference Q.

FIG. 23 illustrates a fuzzy model of each edge pattern represented usinga membership function. In FIG. 23, N represents negative, Z representszero, and P represents positive.

The membership function N takes a function value of one in the rangewhere luminance difference Q is smaller than a certain negative value−Qb, takes a value of zero in the range where luminance difference Q islarger than zero, and takes a value from one to zero that linearlychanges corresponding to the value in the range from −Qb to zero.

In the membership function P, the function value takes the value of zeroin the range where luminance difference Q is smaller than zero, takesthe value of one in the range where luminance difference Q is largerthan a certain positive value Qb, and takes the value between zero toone that linearly changes corresponding to the value in the range ofzero to Qb.

The membership function Z has the function value of zero in the rangewhere the absolute value of luminance difference Q is larger than acertain value Qa, and has the function value of 1 in the range where theabsolute value is smaller than Qb. Then, in the range where the absolutevalue of luminance difference Q is larger than Qb and smaller than Qa,the function value is an intermediate value from one to zero thatlinearly changes corresponding to the absolute value of luminancedifference Q.

The fuzzy model in (a) of FIG. 23 represents a right upward oblique edgepattern that is bright in the lower right direction and is dark in theupper left direction. The fuzzy model illustrated in (b) of FIG. 23represents an edge pattern that is bright in the right direction, isdark in the left direction, and extends in the vertical direction. Thefuzzy model illustrated in (c) of FIG. 23 represents a right downwardoblique edge pattern that is bright in the upper right direction and isdark in the lower left direction. The fuzzy model illustrated in (d) ofFIG. 23 represents an edge pattern that is bright in the upwarddirection, is dark in the downward direction, and extends in thehorizontal direction. The fuzzy model illustrated in (e) of FIG. 23represents a right upward oblique edge pattern that is bright in theupper left direction and is dark in the lower right direction. The fuzzymodel illustrated in (f) of FIG. 23 represents an edge pattern that isbright in the left direction, is dark in the right direction, andextends in the vertical direction. The fuzzy model illustrated in (g) ofFIG. 23 represents a right downward oblique edge pattern that is brightin the upper left direction and is dark in the lower right direction.The fuzzy model illustrated in (h) of FIG. 23 represents an edge patternthat is bright in the downward direction, is dark in the upwarddirection, and extends in the horizontal direction.

For example, the following third to sixth algorithms are previously setas the plurality of evaluation algorithms, and the user selects one ofthe third to sixth algorithms as the target algorithm. The thirdalgorithm outputs the total value of the adaptation calculated using theedge patterns in (a) and (e) of FIG. 23 as the evaluation value. Thefourth algorithm outputs the total value of the adaptation calculatedusing the edge patterns in (b) and (f) of FIG. 23 as the evaluationvalue. The fifth algorithm outputs the total value of adaptationcalculated using the edge patterns in (c) and (g) of FIG. 23 as theevaluation value. The sixth algorithm outputs the total value ofadaptation calculated using the edge patterns in (d) and (h) of FIG. 23as the evaluation value.

It is assumed that a plurality of lines along one direction are formedon the surface of target W, and that the image processing foremphasizing the lines is executed in the image measurement. In thiscase, the evaluation lighting pattern that makes the line conspicuous ispreferable. Accordingly, the user may select the evaluation algorithmaccording to the direction of the line.

For example, when the line is in the vertical direction, the fourthalgorithm is selected. The fourth algorithm calculates the adaptationusing the edge patterns in (b) and (f) of FIG. 23, and outputs the totalvalue of the calculated adaptation as the evaluation value. That is, theevaluation value indicates the edge-likelihood in the verticaldirection. Consequently, by selecting the fourth algorithm, theevaluation lighting pattern that makes the vertical line conspicuous isdetermined as the measurement lighting pattern.

Fifth Modification

In the above description, the shape of lighting device 4 has the domeshape. However, the shape of lighting device 4 is not limited to thedome shape, but may be, for example, a flat surface or a linear shape.The illumination light may be reflected by a half mirror to irradiatethe target. For example, the light sources may be arranged in a matrixshape in lighting device 4, and lighting device 4 may be divided into aplurality of lighting elements.

In addition, in lighting device 4 of FIG. 3, it is also assumed that theemission directions of the light from lighting element 40 are alldirected to the center. However, the emission directions of the lightfrom the plurality of lighting elements are not limited thereto, but maybe directed different from each other.

The light emitted by each lighting element may provide a differentpolarization characteristic. Specifically, five kinds of characteristicsincluding non-polarized light can be provided by mounting linearpolarizing filters of 0 degrees, 45 degrees, 90 degrees, and 135 degreeson the emission surface (outside the diffusion plate) of lightingelement.

§ 3 Another Application Example

With reference to FIG. 24, another application example of the presentinvention will be described. FIG. 24 is a view illustrating anotherconfiguration example of the image processing system.

In the technique disclosed in PTL 1, a lighting angle optimizing theevaluation value is calculated based on captured images obtained byimaging the article at a plurality of lighting angles. At this point,the plurality of lighting angles are previously determined. However, inthe case of the use of the lighting device having many settableconditions such as the color and direction of the lighting, a largenumber of lighting patterns exists, and it takes time required foroptimization when all the lighting patterns are evaluated. On the otherhand, when only the predetermined lighting pattern among the largenumber of lighting patterns is evaluated, the lighting pattern that isnot evaluated may be more suitable. As a result, the optimizationbecomes insufficient.

The present disclosure has been made in view of such the problem, andthe object of the present disclosure is to provide the image processingsystem, the setting method, and the program capable of moreappropriately setting the lighting of illumination so as to be suitablefor the image measurement using the external appearance image of thetarget.

An image processing system 1A in FIG. 24 includes a control device 100Ainstead of control device 100 as compared with image processing system 1in FIG. 1.

Control device 100A typically has a structure according to ageneral-purpose computer architecture. Control device 100A is differentfrom control device 100 in that the evaluation algorithm selection unit220 is not provided and an image acquisition unit 210A is providedinstead of image acquisition unit 210.

The plurality of lighting patterns that can be taken by lighting device4 are previously divided into a plurality of groups. Image acquisitionunit 210A selects at least one group from the plurality of groupsaccording to the input to the user interface, and determines theplurality of lighting patterns belonging to the selected at least onegroup as a plurality of evaluation lighting patterns. Image acquisitionunit 210A irradiates the target with the illumination light fromlighting device 4 according to each of the plurality of selectedevaluation lighting patterns xi, and acquires at least one evaluationimage R corresponding to each evaluation lighting pattern xi from camera8.

In image processing system 1A of FIG. 24, calculation unit 230 maycalculate evaluation value Pi indicating the adaptation to the imagemeasurement using the predetermined evaluation algorithm and theevaluation image R corresponding to the evaluation lighting pattern xi.

The specific example of image processing system 1A in FIG. 24 is commonto, for example, the above-described “§ 2 specific example”. That is,for example, the plurality of groups includes the first group in FIG. 8,the second group in FIG. 9, and the third group in FIG. 10. In addition,the plurality of groups may include a group including the plurality oflighting patterns in which the emission color of the plurality oflighting elements 40 is white and a group including the plurality oflighting patterns in which the emission color of the plurality oflighting elements 40 is a color other than white.

According to the image processing system 1A in FIG. 24, the groupaccording to the image measurement can be selected from the plurality ofgroups. Thus, the time required for the optimization can be shortened ascompared with the case of evaluating all of the plurality of lightingpatterns that can be taken by lighting device 4. Furthermore, the groupto be evaluated can be selected from the plurality of groups, so thatthe lighting pattern to be evaluated can be avoided becoming not to beevaluated. Thus, it is possible to achieve the image processing systemcapable of more appropriately setting the lighting of illumination so asto be suitable for the image measurement using the external appearanceimage of the target.

§ 4 Appendix

As described above, the embodiment includes the following disclosure.

(Configuration 1)

An image processing system (1) that performs image measurement using anexternal appearance image of a target (W), the image processing system(1) including:

an imaging unit (8) configured to image the target (W);

a lighting unit (4) including a plurality of lighting elements (40, 41,42 to 45, 42L to 45L, 42M to 45M, 42U to 45U) that irradiates the target(W) with light, the lighting unit (4) being capable of adjusting atleast one of emission intensity and emission color for each lightingelement;

an image acquisition unit (110, 210) configured to emit illuminationlight from the lighting unit (4) according to each of a plurality ofevaluation lighting patterns different from each other and acquire atleast one evaluation image corresponding to each evaluation lightingpattern from the imaging unit;

a selection unit (110, 220) configured to select one target algorithmfrom a plurality of evaluation algorithms;

a calculation unit (110, 230) configured to calculate an evaluationvalue indicating adaptation to the image measurement for each evaluationlighting pattern using the target algorithm and the at least oneevaluation image corresponding to the evaluation lighting pattern; and

a pattern determination unit (110, 240) configured to determine alighting pattern to be used for the image measurement from the pluralityof evaluation lighting patterns based on the evaluation value.

(Configuration 2)

The image processing system (1) described in the configuration 1,wherein the plurality of evaluation algorithms includes: a firstalgorithm that outputs a first evaluation value depending on adifference between at least one first region and at least one secondregion in the at least one evaluation image as the evaluation value; andat least one second algorithm that outputs a second evaluation valuedepending on uniformity of the at least one second region as theevaluation value.

(Configuration 3)

The image processing system (1) described in the configuration 2,wherein the at least one second algorithm includes a plurality of secondalgorithms having different contribution rates of the uniformity to thesecond evaluation value.

(Configuration 4)

The image processing system (1) described in the configuration 2 or 3,wherein each of the at least one second algorithm

outputs the second evaluation value using a threshold value when a valuecorresponding to variance of luminance of a plurality of pixelsbelonging to the at least one second region is smaller than thethreshold value,

outputs the second evaluation value using the value corresponding to thevariance when the value corresponding to the variance is greater than orequal to the threshold value, and

the threshold value is set according to the at least one secondalgorithm.

(Configuration 5)

The image processing system (1) described in any one of theconfigurations 2 to 4, further including a user interface (102),

wherein the calculation unit (110, 230)

determines a shape, a size, and a position of the at least one firstregion according to input to the user interface (102),

sets a shape and a size of the at least one second region to beidentical to the shape and the size of the at least one first region,and

determines a position of the at least one second region according to theinput to the user interface (102).

(Configuration 6)

The image processing system (1) described in the configuration 1,wherein the plurality of evaluation algorithms outputs a thirdevaluation value indicating an edge-likelihood of a pixel belonging to adesignated region in the at least one evaluation image using edgepatterns different from each other as the evaluation value.

(Configuration 7)

The image processing system (1) described in any one of theconfigurations 1 to 6, wherein the at least one evaluation imageincludes a plurality of evaluation images,

the calculation unit calculates the evaluation value for each of theplurality of evaluation images,

the pattern determination unit (110, 240)

extracts a lowest evaluation value having a lowest adaptation from theevaluation values regarding the plurality of evaluation images for eachevaluation lighting pattern; and

determines an evaluation lighting pattern in which the lowest evaluationvalue having a highest adaptation is extracted from the plurality ofevaluation lighting patterns as the lighting pattern to be used for theimage measurement.

(Configuration 8)

The image processing system (1) described in any one of theconfigurations 1 to 7, wherein a plurality of lighting patterns that canbe taken by the lighting unit (4) are previously divided into aplurality of groups, and

the image acquisition unit (110, 210)

selects at least one group from the plurality of groups; and

determines a plurality of lighting patterns belonging to the selected atleast one group as the plurality of evaluation lighting patterns.

(Configuration 9)

The image processing system (1) described in the configuration 8,wherein the plurality of lighting elements (40, 41, 42 to 45, 42L to45L, 42M to 45M, 42U to 45U) are radially arranged along first to Nthradial directions at equal angular intervals,

N is an integer greater than or equal to 2, and

the plurality of groups includes:

a first group including a plurality of lighting patterns in whichirradiation intensities in the first to Nth radial directions areuniform; and

a second group including a plurality of lighting patterns in which onlythe lighting element disposed in one of the first to Nth radialdirections is turned on.

(Configuration 10)

The image processing system (1) described in the configuration 9,wherein N is an even number greater than or equal to 4, and

the plurality of groups further includes a third group including aplurality of lighting patterns in which only lighting elements arrangedalong a pair of radial directions opposite to each other in the first toNth radial directions are turned on.

(Configuration 11)

The image processing system (1) described in the configuration 8,wherein the plurality of groups includes:

a first group including a plurality of lighting patterns in whichemission colors of the plurality of lighting elements are white; and

a second group including a plurality of lighting patterns in whichemission colors of the plurality of lighting elements are colors otherthan white.

(Configuration 12)

The image processing system (1) described in the configuration 1,further comprising a user interface (102),

wherein the selection unit (110, 220) selects the target algorithmaccording to input to the user interface (102).

(Configuration 13)

A setting method for performing lighting setting of a lighting unit (4)that includes a plurality of lighting elements (40, 41, 42 to 45, 42L to45L, 42M to 45M, 42U to 45U) irradiating a target (W) with light and iscapable of adjusting at least one of emission intensity and emissioncolor for each lighting element, the setting method comprising:

emitting illumination light from the lighting unit (4) according to eachof a plurality of evaluation lighting patterns different from each otherand acquiring at least one evaluation image corresponding to eachevaluation lighting pattern from an imaging unit (8) that images thetarget (W);

selecting one target algorithm from a plurality of evaluationalgorithms;

calculating an evaluation value indicating adaptation to imagemeasurement in which an external appearance image of the target is usedusing the target algorithm and the at least one evaluation imagecorresponding to the evaluation lighting pattern for each evaluationlighting pattern; and

determining a lighting pattern to be used for the image measurement fromthe plurality of evaluation lighting patterns based on the evaluationvalue.

(Configuration 14)

A program causing a computer to execute the setting method described inthe configuration 13.

(Configuration 15)

An image processing system (1A) that performs image measurement using anexternal appearance image of a target (W), the image processing system(1A) including:

an imaging unit (8) configured to image the target (W);

a lighting unit (4) including a plurality of lighting elements (40, 41,42 to 45, 42L to 45L, 42M to 45M, 42U to 45U) irradiating the target (W)with light, the lighting unit (4) being capable of adjusting at leastone of emission intensity and emission color for each lighting element,a plurality of lighting patterns that can be taken by the lighting unit(4) being previously divided into a plurality of groups;

an image acquisition unit (110A, 210) configured to select at least onegroup from the plurality of groups, emit illumination light from thelighting unit (4) according to each of a plurality of evaluationlighting patterns belonging to the at least one group, and acquire atleast one evaluation image corresponding to each evaluation lightingpattern from the imaging unit (8);

a calculation unit (110, 230) configured to calculate an evaluationvalue indicating adaptation to the image measurement for each evaluationlighting pattern using the at least one evaluation image correspondingto the evaluation lighting pattern; and

a pattern determination unit (110, 240) configured to determine alighting pattern to be used for the image measurement from the pluralityof evaluation lighting patterns based on the evaluation value.

(Configuration 16)

The image processing system (1A) described in the configuration 15,wherein the plurality of lighting elements are radially arranged alongfirst to Nth radial directions at equal angular intervals,

N is an integer greater than or equal to 2, and

the plurality of groups includes:

a first group including a plurality of lighting patterns in whichirradiation intensities in the first to Nth radial directions areuniform; and

a second group including a plurality of lighting patterns in which onlythe lighting element disposed in one of the first to Nth radialdirections is turned on.

(Configuration 17)

The image processing system (1A) described in the configuration 16,wherein N is an even number greater than or equal to 4, and

the plurality of groups further includes a third group including aplurality of lighting patterns in which only lighting elements arrangedalong a pair of radial directions opposite to each other in the first toNth radial directions are turned on.

(Configuration 18)

The image processing system (1A) described in the configuration 15,wherein the plurality of groups includes:

a first group including a plurality of lighting patterns in whichemission colors of the plurality of lighting elements are white; and

a second group including a plurality of lighting patterns in whichemission colors of the plurality of lighting elements are colors otherthan white.

(Configuration 19)

The image processing system (1A) described in any one of theconfigurations 15 to 18, further comprising a user interface (102),

wherein the image acquisition unit (110A, 210) selects the at least onegroup according to input to the user interface (102).

(Configuration 20)

A setting method for performing lighting setting of a lighting unit (4)that includes a plurality of lighting elements (40, 41, 42 to 45, 42L to45L, 42M to 45M, 42U to 45U) irradiating a target (W) with light and iscapable of adjusting at least one of emission intensity and emissioncolor for each lighting element, the setting method comprising:

a plurality of lighting patterns that can be taken by the lighting unit(4) being previously divided into a plurality of groups,

selecting at least one group from the plurality of groups, emittingillumination light from the lighting unit (4) according to each of aplurality of evaluation lighting patterns belonging to the at least onegroup, and acquiring at least one evaluation image corresponding to eachevaluation lighting pattern from an imaging unit (8) that images thetarget (W);

calculating an evaluation value indicating adaptation to imagemeasurement using the at least one evaluation image corresponding to theevaluation lighting pattern for each evaluation lighting pattern; and

determining a lighting pattern to be used for the image measurement fromthe plurality of evaluation lighting patterns based on the evaluationvalue.

(Configuration 21)

A program (150) causing a computer to execute the setting methoddescribed in the configuration 20.

Although the embodiment of the present invention have been described, itshould be considered that the disclosed embodiments are an example inall respects and not restrictive. The scope of the present invention isindicated by the claims, and it is intended that all modificationswithin the meaning and scope of the claims are included in the presentinvention.

REFERENCE SIGNS LIST

-   1, 1A: image processing system, 4: lighting device, 8: camera, 40,    41, 42 to 45, 42L to 45L, 42M to 45M, 42U to 45U: lighting element,    46: opening, 47: reflection plate, 48: diffusion plate, 60: setting    screen, 61, 62, 63: tab, 64, 65, 80: input field, 66 to 68, 78, 79,    82: check box, 69 to 72, 76, 77, 84, 86: button, 73, 74: display    field, 75, 81, 83, 85: region, 90: defect portion, 91: edit button,    92: region shape selection button group, 93: size editing region,    94, 94 a, 98, 98 a, 98 b: frame line, 95: change button, 96: OK    button, 97: cancel button, 100, 100A: control device, 101: display,    102: touch panel, 110: processor, 112: RAM, 114: display controller,    116: system controller, 118: I/O controller, 120: hard disk, 122:    device interface, 124: input interface, 128: communication    interface, 130: memory card interface, 136: memory card, 150:    control program, 210, 210A: image acquisition unit, 220: evaluation    algorithm selection unit, 230: calculation unit, 240: lighting    pattern determination unit, D1: first radial direction, D2: second    radial direction, D3: third radial direction, D4: fourth radial    direction, H₀ to H_(m-1): defect region, R, Ri: evaluation image, S:    sample image, W: target, h₀ to h_(n-1): background region, and xi:    evaluation lighting pattern.

1. An image processing system that performs image measurement using anexternal appearance image of a target, the image processing systemcomprising: an imaging unit configured to image the target; a lightingunit including a plurality of lighting elements that irradiates thetarget with light, the lighting unit being capable of adjusting at leastone of emission intensity and emission color for each lighting element;an image acquisition unit configured to emit illumination light from thelighting unit according to each of a plurality of evaluation lightingpatterns different from each other and acquire at least one evaluationimage corresponding to each evaluation lighting pattern from the imagingunit; a selection unit configured to select one target algorithm from aplurality of evaluation algorithms; a calculation unit configured tocalculate an evaluation value indicating adaptation to the imagemeasurement for each evaluation lighting pattern using the targetalgorithm and the at least one evaluation image corresponding to theevaluation lighting pattern; and a pattern determination unit configuredto determine a lighting pattern to be used for the image measurementfrom the plurality of evaluation lighting patterns based on theevaluation value.
 2. The image processing system according to claim 1,wherein the plurality of evaluation algorithms includes: a firstalgorithm that outputs a first evaluation value depending on adifference between at least one first region and at least one secondregion in the at least one evaluation image as the evaluation value; andat least one second algorithm that outputs a second evaluation valuedepending on uniformity of the at least one second region as theevaluation value.
 3. The image processing system according to claim 2,wherein the at least one second algorithm includes a plurality of secondalgorithms having different contribution rates of the uniformity to thesecond evaluation value.
 4. The image processing system according toclaim 2, wherein each of the at least one second algorithm outputs thesecond evaluation value using a threshold value when a valuecorresponding to variance of luminance of a plurality of pixelsbelonging to the at least one second region is smaller than thethreshold value, outputs the second evaluation value using the valuecorresponding to the variance when the value corresponding to thevariance is greater than or equal to the threshold value, and thethreshold value is set according to the at least one second algorithm.5. The image processing system according to claim 2, further comprisinga user interface, wherein the calculation unit determines a shape, asize, and a position of the at least one first region according to inputto the user interface, sets a shape and a size of the at least onesecond region to be identical to the shape and the size of the at leastone first region, and determines a position of the at least one secondregion according to the input to the user interface.
 6. The imageprocessing system according to claim 1, wherein the plurality ofevaluation algorithms outputs a third evaluation value indicating anedge-likelihood of a pixel belonging to a designated region in the atleast one evaluation image using edge patterns different from each otheras the evaluation value.
 7. The image processing system according toclaim 1, wherein the at least one evaluation image includes a pluralityof evaluation images, the calculation unit calculates the evaluationvalue for each of the plurality of evaluation images, and the patterndetermination unit extracts a lowest evaluation value having a lowestadaptation from the evaluation values regarding the plurality ofevaluation images for each evaluation lighting pattern; and determinesan evaluation lighting pattern in which the lowest evaluation valuehaving a highest adaptation is extracted from the plurality ofevaluation lighting patterns as the lighting pattern to be used for theimage measurement.
 8. The image processing system according to claim 1,wherein a plurality of lighting patterns that can be taken by thelighting unit are previously divided into a plurality of groups, and theimage acquisition unit selects at least one group from the plurality ofgroups; and determines a plurality of lighting patterns belonging to theselected at least one group as the plurality of evaluation lightingpatterns.
 9. The image processing system according to claim 8, whereinthe plurality of lighting elements are radially arranged along first toNth radial directions at equal angular intervals, N is an integergreater than or equal to 2, and the plurality of groups includes: afirst group including a plurality of lighting patterns in whichirradiation intensities in the first to Nth radial directions areuniform; and a second group including a plurality of lighting patternsin which only the lighting element disposed in one of the first to Nthradial directions is turned on.
 10. The image processing systemaccording to claim 9, wherein N is an even number greater than or equalto 4, and the plurality of groups further includes a third groupincluding a plurality of lighting patterns in which only lightingelements arranged along a pair of radial directions opposite to eachother in the first to Nth radial directions are turned on.
 11. The imageprocessing system according to claim 8, wherein the plurality of groupsincludes: a first group including a plurality of lighting patterns inwhich emission colors of the plurality of lighting elements are white;and a second group including a plurality of lighting patterns in whichemission colors of the plurality of lighting elements are colors otherthan white.
 12. The image processing system according to claim 1,further comprising a user interface, wherein the selection unit selectsthe target algorithm according to input to the user interface.
 13. Asetting method for performing lighting setting of a lighting unit thatincludes a plurality of lighting elements that irradiates a target withlight and is capable of adjusting at least one of emission intensity andemission color for each lighting element, the setting method comprising:emitting illumination light from the lighting unit according to each ofa plurality of evaluation lighting patterns different from each otherand acquiring at least one evaluation image corresponding to eachevaluation lighting pattern from an imaging unit that images the target;selecting one target algorithm from a plurality of evaluationalgorithms; calculating an evaluation value indicating adaptation toimage measurement in which an external appearance image of the target isused using the target algorithm and the at least one evaluation imagecorresponding to the evaluation lighting pattern for each evaluationlighting pattern; and determining a lighting pattern to be used for theimage measurement from the plurality of evaluation lighting patternsbased on the evaluation value.
 14. A non-transitory computer-readablestorage medium storing a program causing a computer to execute thesetting method according to claim 13.